const http = require("./http");
class askedHttp extends http {
  static getQuestionHttp() {
    return this.request(`/api/everyday/question`);
  }
  // 处理时间戳
  static handleTime(time) {
    const date = new Date(time)
    const year = date.getFullYear();
    const month = date.getMonth() + 1;
    const day = date.getDate();
    const hour = date.getHours()
    const minute = date.getMinutes()
    const second = date.getSeconds()
    return [year, month, day].map(this.handleNumber).join('/') + ' ' + [hour, minute,second].join(':')
  }
  // 补零操作
  static handleNumber(n){
    n = n.toString()
    return n[1] ? n : '0' + n
  }
}
module.exports = askedHttp;